//
//  MHMomentVideo.m
// MiaoCircle
//
//Created by acgera on 2018/4/9.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHMomentVideo.h"

@implementation MHMomentVideo

- (void)setFileName:(NSString *)fileName{
    _fileName = [fileName copy];
    
    /// 这里设置封面和播放地址  因为这里都是本地的
//    if (!MHStringIsNotEmpty(fileName)) return;
//    NSString *urlStr = [[NSBundle mainBundle]pathForResource:fileName ofType:nil];
//    self.videoURL = [NSURL URLWithString:self.videoURL];
//    self.coverImage = []
    /// 获取视频第一政
    self.coverImage = [UIImage mh_thumbnailImageForVideo:self.videoURL atTime:1];
    
    
}

//为了获取视频的缩放比例
-(CGFloat)scale
{
    return 1;
//    CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)self.coverURL, NULL);
//    NSDictionary* imageHeader = (__bridge NSDictionary*) CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
//    CGFloat pixelWidth = [[imageHeader objectForKey:@"PixelWidth"] floatValue];
//    CGFloat pixelHeight = [[imageHeader objectForKey:@"PixelHeight"] floatValue];
//
//    CGFloat scale = pixelWidth/pixelHeight == 0 ? 0.1: pixelWidth/pixelHeight;
//    if (isnan(pixelWidth/pixelHeight)) {
//        return 1;
//    }
//    return scale;
}
@end
